using System;
using System.Collections.Generic;
using System.Linq;

namespace DIS_WEB_Client.Repositories
{
	#region using
	using DIS_WEB_Client.Helpers;
    using DIS_Web_Client.DIS_WS_BusinessLayer;
	#endregion
	public class ChemistWareHouseRepository
	{
		public ChemistWareHouseDTO SelectOnlineWareHouse()
		{
			try
			{
                return BusService.Instance.ChemistWareHouse_SelectAll().First(n => n.Name.ToUpper().Contains("ONLINE"));
			}
			catch(Exception ex)
			{
				if (ex.InnerException != null)
				{
					GlobalVariables.Logger.Error(ex.InnerException.Message);
				}
				else
				{
					GlobalVariables.Logger.Error(ex.Message);
				}
			}
			return null;
		}

        public List<ChemistWareHouseDTO> RetrieveOnlineWareHouse()
		{
			try
			{
                return BusService.Instance.ChemistWareHouse_SelectAll().Where(n => n.Name.ToUpper().Contains("ONLINE")).ToList();
			}
			catch(Exception ex)
			{
				if (ex.InnerException != null)
				{
					GlobalVariables.Logger.Error(ex.InnerException.Message);
				}
				else
				{
					GlobalVariables.Logger.Error(ex.Message);
				}
			}
			return new List<ChemistWareHouseDTO>();
		}

	}
}